package cn.lyh.FoodSystem.Tool;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.FrameGrabber;

public class VideoLong {
    public static String getVideoDuration(String videoPath) {
        double duration = 0;
        try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(videoPath)) {
            frameGrabber.start();
            duration = frameGrabber.getLengthInTime() / (double) 1000;
            frameGrabber.stop();
        } catch (FrameGrabber.Exception e) {
            e.printStackTrace();
        }
        return String.valueOf(duration);
    }


}
